home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mgr / src / rops.c < prev    next >
C/C++ Source or Header  |  1989-09-26  |  987b  |  51 lines

  1. /* test random bitblit functions (S. A. Uhler) */
  2.  
  3. #include <stdio.h>
  4. #include "bitmap.h"
  5.  
  6. #define message(x) \
  7.     if(bit_debug){printf("%s\n",x);fflush(stdout);}
  8.  
  9. #define FRACTION        850                /* maximum blit size (parts/1000)*/
  10.  
  11. int bit_debug = 0;
  12.  
  13. main(argc,argv)
  14. char **argv;
  15.    {
  16.    register BITMAP *screen;
  17.    register int x,y,w,h,op,xs,ys;
  18.     int maxx, maxy;
  19.     int min,max;
  20.     int count;
  21.  
  22.    bit_debug = getenv("DEBUG");
  23.  
  24.    screen = bit_open("/dev/bwtwo0");
  25.     
  26.     if (argc < 3) {
  27.         printf("usage: %s min_size max_size count\n",*argv);
  28.         exit(1);
  29.         }
  30.  
  31.     min = atoi(argv[1]);
  32.     max = atoi(argv[2]);
  33.     count = atoi(argv[3]);
  34.  
  35.     if (min >= max)
  36.         max = min +1;
  37.     maxx = max-min;
  38.     maxy = max-min;
  39.  
  40.     while (count-- > 0) {
  41.         op = random()&15;
  42.         w = min + random()%maxx;
  43.         h = min + random()%maxy;
  44.         x = random()%(BIT_WIDE(screen)-w);
  45.         y = random()%(BIT_HIGH(screen)-h);
  46.         xs = random()%(BIT_WIDE(screen)-w);
  47.         ys= random()%(BIT_HIGH(screen)-h);
  48.       mem_rop(screen,x,y,w,h,op,screen,xs,ys);
  49.       }
  50.    }
  51.